﻿package com.dr.aliyun;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118667294";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDFjaPU2PFfB9wPh3ogO+aUDE/MlU4zPktqcd/UhqsLBd36T/pdyL+sgFOBiG25uA3nk9DwePlWmfK+aIyTXpXpRrmv0A4z4azpWPKXmwTECvY44OR13Yt/d23KPa2l/q6YjPr9A4+2kt9N09VIhK0aX33aUhktfKC1uxDvAYvNU7rz8xpQ1KfY6zdmG6aU6Jp0JdRwz0XFIhxVTZuKBWNdNOpZsAGD/t3ocfIBhOZtMPXnW5+q9qRY7vrPHsraWGR5RLk9OGC/0tODYhbILIWsggQiQ/A6mXrdz1zL3TuPgzMUgojaQUbsVqYuhThS7vtvjqB1SUx6ql36+lhqxvsRAgMBAAECggEBAJNd7XDBxIyXWFldPoT9KiwWYxDB7+vZ9HgbKlVngABhCA3Jy4JaVmFf+OsP0opP+k9dvOcl1xn7DVFsvDDSxhGWaL31/iJFnq8TYyQkx5FWfAZB/SrPcVhMxuGu0PKa4bN6t2A2X+ZZ+aoc82V9U4Pw5/kMdSuxZFEskp04Egm/siTGWm88e/3DVYR6hjeutPcMSlJgjl+/crzuY1RyZrdhxE6o7VvZZGKLbMCWgJ4/smgjx9n8niw/A3yQucD986IRUq0Eerfkxyb5Kj7pxRLjTzciUbWmijlyiq0cYXEv4wg+NbG5PnWH0W09POFuXDqD1GGUmbC9hmKkvylRjgECgYEA/c6u9x32Ar5ntmVFbxDRH5oBezWAJcrnux2Chyo8P/EpM1et3nVW+AUW3vlj7D07KyuTWr6mDwYKNJDiXBfUcfoPGA9gHJSFIASJk2415QUVy64TKFkeNsrQrdNdHylRXoEMU+bKx8ZIZX1QhJxRD7XFevlRQABhOJIsecEJZckCgYEAx0KLvAg6yip6Wrcbcx3EN4CHdQNI68diCcRgNmrQqYzCuGNWUXK92RctP6AYQexC8/SuQSofnHDcZb9zJugYApVNZjRM75vee9f9VFk67pcKhKRboaz9bIqnhvdKXxp9TAzmMa8PMNwKx/nPpfAd/vMNJHNViKiUg4oCA/TurwkCgYEAmW0UpXuuGHCDf2XuuDohQIo3dQSdZ7slpB4tpomojDq7XjcVetHR9fIVpkp51fgZyXn5BLUU6yYKi0Y+H8+j9BZmg3Pf9MbvRrCXfdD0sXIGf+7F0/Eza4nk5f9MXqb6cjdufVWZpXQ+lWNQhil8cxO9wh3uuNLB8pGiYyOHC8kCgYBq1MnYUU070NRyyJNl/8KQw09ctBsnlmmAtRGke1ZOYRKRC2lfF7ajquJup2X6CjLHWxsGAxCZroTr5F5XsL4WvHeX4ViSaq45Fc9TpteKzd4syXX7U6U3yYsSOIlePfSJjqzoXGQ3nPIGz2++FuPuKd+U+GUWdNPTRm3YMzy5CQKBgEOAXPoDhZTCcNUrQz514wCH23WPUAxi1nE0sHRnlcKRQxE77g7KSaPYlBmbI4KN5R3YbbIFX755dL7qm82NW2od8kbz75ptD9Fkx2GjxPGRufIXj2w27BxmAuG7IoikfYV8WF5LTtHMqnuQUQQcUxCLqFp4AKedS5bXuY8BnqGT";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjfgY3ddCtUvtnWVnD8cy029Si32cST7PBHLPzpqYAZTFFt2vSHG7zHJ1dqCd1kVNgkFWzegqYRTjTZZTJfJ0guYhvpNwWA7kY+ygvqvlAJ2ws0Cdw+4J4zI4n4RfFIACgB3WjenB8lNFX0wGzmO9s6BTRkUjA74FQVJDPBwmEct5UmvaLnVpRxU8eBtMl18c+zKZWfeniCp6Jcnfjm/dSEpRz8Lsg3ppBAqomv+8msx0W9QEAJzYbCNRpnUVgwvrRNRVqgEmTeTzeXaej5D6VTxDQHz34HQ1LrR4O/gnan9hidIZlcPB7ZlkFvgmSIHIfIBwETIT7kJ6cZlxbyefUwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/Dr.DiamondRing/index/notifyUrl.do";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/Dr.DiamondRing/index/returnUrl.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

